#include <stdio.h>

int main()
{
    unsigned int r, x, y;
    scanf("%x,%d,%d", &r, &x, &y);
    r &= ~((1 << x) | (1 << (y - 2)));
    r |= 3 << (y - 1);
    printf("%x\n", r);
    return 0;
}